import Vue from 'vue'
import Home from '@/views/Home'
import Plate from '@/views/Plate'
import Order from '@/views/Order'
import My from '@/views/My'

import Pager from '@/views/Pager'
import News from '@/views/News'
import Sport from '@/views/Sport'

import SportHome from '@/views/second/SportHome'
import SportNei from '@/views/second/SportNei'
import SportWai from '@/views/second/SportWai'
import UI_Router from '@/views/UI_Router'
import Contacts from '@/views/Contacts'
import About from '@/views/About'
import ALL_contacts from '@/views/second/ALL_contacts'
import Alice from '@/views/second/Alice'
import Bob from '@/views/second/Bob'
import Blog from '@/views/second/third/Blog'
import Fax from '@/views/second/third/Fax'
import ArticleDetail from '@/views/ArticleDetail'
import Layout from '@/views/Layout'
import Article from '@/views/Article'
import Collect from '@/views/Collect'
import Like from '@/views/Like'
import User from '@/views/User'

//第一步引入vue-router
import VueRouter from 'vue-router'

//二,使用Vue.use方法 使用VueRouter
Vue.use(VueRouter)
//三,创建路由实例
const router = new VueRouter({
  // RouterLink会自动给当前的链接添加两个类名
  //   router-link-active: 激活的导航链接   模糊匹配
  //   router-link-exact-active:  激活的导航链接 精确匹配

  routes: [
    {
      path: '/',
      component: Layout,
      children: [
        {
          path: '/article',
          component: Article,
        },
        {
          path: '/collect',
          component: Collect,
        },
        {
          path: '/like',
          component: Like,
        },
        {
          path: '/user',
          component: User,
        },
      ],
    },
    {
      path: '/detail/:id', //表示需要一个id作为参数
      component: ArticleDetail,
    },
    {
      path: '/ui_router',
      component: UI_Router,
    },
    {
      path: '/contacts',
      component: Contacts,
      children: [
        {
          path: 'all_contacts',
          component: ALL_contacts,
        },
        {
          path: 'alice',
          component: Alice,
        },
        {
          path: 'bob',
          component: Bob,
          children: [
            {
              path: 'blog',
              component: Blog,
            },
            {
              path: 'fax',
              component: Fax,
            },
          ],
        },
      ],
    },
    {
      path: '/about',
      component: About,
    },
    {
      path: '/home',
      name: 'home',
      component: Home,
    },
    {
      path: '/plate',
      name: 'plate',
      component: Plate,
    },
    {
      path: '/order',
      name: 'order',
      component: Order,
    },
    {
      path: '/my',
      name: 'my',
      component: My,
    },
    {
      path: '/pager',
      component: Pager,
    },
    {
      path: '/news',
      component: News,
    },
    {
      path: '/sport',
      component: Sport,

      children: [
        {
          path: 'sporthome',
          component: SportHome,
        },
        {
          path: 'sportnei',
          component: SportNei,
        },
        {
          path: 'sportwai',
          component: SportWai,
        },
      ],
    },
  ],
})
//将他暴露出来
export default router
